/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aso.upna.net;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

/**
 *
 * @author triki
 */

public class TcpObjectReceive {

    public static Object receive_from(Socket sock)
    {
        try
        {
            ObjectInputStream ois = new ObjectInputStream(sock.getInputStream());
            Object obj = ois.readObject();
            return obj;
        }
        catch (ClassNotFoundException ex)
        {
            ex.printStackTrace();
            return null;
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
            return null;
        }
    }

}
